package com.xzc.jcip._2_.线程安全性问题;

import net.jcip.annotations.NotThreadSafe;

/**
 * 竞状条件=>check-then-act
 */
@NotThreadSafe
public class LazyInitRace {
    private ExpensiveObject instance = null;

    public ExpensiveObject getInstance() {
        if (instance == null)
            instance = new ExpensiveObject();
        return instance;
    }
}
